Skip to content

test(swift-sdk): first swift sdk integration tests with local network#3712

Draft
ZocoLini wants to merge 1 commit into
v3.1-devfrom
feat/swift-sdk-integration-tests
Draft

test(swift-sdk): first swift sdk integration tests with local network#3712
ZocoLini wants to merge 1 commit into
v3.1-devfrom
feat/swift-sdk-integration-tests

Conversation

@ZocoLini

@ZocoLini ZocoLini commented May 20, 2026

Copy link
Copy Markdown
Collaborator

Issue being fixed or feature implemented

What was done?

How Has This Been Tested?

Breaking Changes

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • Tests

    • Added end-to-end integration tests for wallet send flows, SDK bootstrap and initialization, plus supporting test harness and RPC/devnet helpers.
    • Introduced utilities for subprocess/shell runs, test wallets, and shared integration environment to run suites against a local devnet.
  • Chores

    • Reorganized and removed legacy unit test suites and example artifacts.
    • Updated CI/workflow and local test runner scripts to streamline integration test execution and devnet lifecycle; extended build script deployment target exports.
  • Documentation

    • Fixed relative links in a PlatformWallet README.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1066735c-5a13-4b2d-8352-8da59569b8c9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Migrates Swift SDK testing from many mock/unit tests to a devnet-backed integration test harness: deletes old test suites and headers, adds integration helpers and tests, updates package manifest and build scripts, and changes CI workflow to invoke the new runners.

Changes

Swift SDK Integration Test Migration

Layer / File(s) Summary
CI workflow and job script changes
.github/workflows/swift-sdk-build.yml, packages/swift-sdk/run_tests.sh, packages/swift-sdk/run_integration_tests.sh
Replaces Xcodebuild steps with packages/swift-sdk/run_tests.sh, adds Node/Rust/tooling setup, dashmate reset/run/stop lifecycle, and invokes run_integration_tests.sh from CI.
Package manifest and build scripts
packages/swift-sdk/Package.swift, packages/swift-sdk/build_ios.sh, packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/README.md
Adds SwiftDashSDKIntegrationTests target, excludes README files from binary target, links SystemConfiguration, exports MACOSX_DEPLOYMENT_TARGET, and fixes README test links.
Integration test harness and helpers
packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/* (IntegrationTestEnv.swift, IntegrationTestCase.swift, LocalDevnet.swift, CoreRPCClient.swift, Shell.swift, TestWallet.swift)
Introduces suite-wide bootstrap, SPV startup, Core RPC client, local devnet discovery, subprocess helper, test wallet wrapper, and waiting utilities used by integration tests.
New integration tests
packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Core/*, .../Platform/*, .../SwiftDashSDKTests/*
Adds CoreSendIntegrationTests, SDKBootstrapIntegrationTests, and several new unit/integration test files for identity/PlatformWallet and hex parsing.
Removed legacy mocks, tests, and examples
packages/swift-sdk/SwiftTests/Tests/*, packages/swift-sdk/SwiftTests/SwiftDashSDK.h, packages/swift-sdk/example/SwiftSDKExample.swift, packages/swift-sdk/Tests/*
Deletes many prior test suites, C ABI header and mock sources, example files, and the old run_tests.sh runner manifesting the shift to integration-focused testing.

Sequence Diagram

sequenceDiagram
  participant Developer as Dev / CI
  participant CI as GitHub Actions
  participant Runner as run_tests.sh
  participant IntegrationRunner as run_integration_tests.sh
  participant Dashmate as dashmate (local devnet)
  participant Core as dashd (Core RPC)
  participant SwiftTests as SwiftDashSDKIntegrationTests

  CI->>Runner: run unit build & tests
  Runner->>SwiftTests: swift build/test, xcodebuild test
  CI->>IntegrationRunner: run integration flow
  IntegrationRunner->>Dashmate: reset/start devnet
  IntegrationRunner->>Core: Core RPC calls via CoreRPCClient (getnewaddress, sendtoaddress, generatetoaddress)
  IntegrationRunner->>SwiftTests: RUN_INTEGRATION_TESTS=1 swift test SwiftDashSDKIntegrationTests
  IntegrationRunner->>Dashmate: stop (always)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • dashpay/platform#3222: Related to changes around Swift SDK mock/version and prior mock test adjustments.
  • dashpay/platform#3634: Overlaps with CreateIdentityView.parseOutPointHex(_:) concurrency/isolation change.

Suggested reviewers

  • shumkov
  • QuantumExplorer

Poem

🐰 From mocks to devnets, tests now leap and run,
SPV hums, wallets dance beneath the morning sun,
Scripts stitch yarn, dashmate wakes the chain,
Assertions nibble bugs until they're tame,
A carrot toast — integration hops, well done!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 38.10% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and concisely describes the main change: adding initial Swift SDK integration tests that use a local network for testing.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/swift-sdk-integration-tests

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added this to the v3.1.0 milestone May 20, 2026
@ZocoLini ZocoLini changed the title Feat/swift sdk integration tests test(swift-sdk): first swift sdk integration tests with local network May 20, 2026
@ZocoLini ZocoLini force-pushed the feat/swift-sdk-integration-tests branch 6 times, most recently from b16e06f to 361114b Compare May 26, 2026 20:57
@ZocoLini ZocoLini marked this pull request as ready for review May 26, 2026 21:00
@ZocoLini ZocoLini force-pushed the feat/swift-sdk-integration-tests branch from 361114b to 59ef0d4 Compare May 26, 2026 21:04
@ZocoLini ZocoLini closed this May 26, 2026
@ZocoLini ZocoLini reopened this May 26, 2026
@github-actions

github-actions Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

✅ DashSDKFFI.xcframework built for this PR.

SwiftPM (host the zip at a stable URL, then use):

.binaryTarget(
  name: "DashSDKFFI",
  url: "https://your.cdn.example/DashSDKFFI.xcframework.zip",
  checksum: "b12b8793f11e97a6829590cab1d11aa9e71a103876c4b44407b2d45c93ccdbb1"
)

Xcode manual integration:

  • Download 'DashSDKFFI.xcframework' artifact from the run link above.
  • Drag it into your app target (Frameworks, Libraries & Embedded Content) and set Embed & Sign.
  • If using the Swift wrapper package, point its binaryTarget to the xcframework location or add the package and place the xcframework at the expected path.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/swift-sdk/SwiftTests/SwiftDashSDKTests/PlatformWalletTypesTests.swift (1)

27-34: ⚡ Quick win

Make odd-length hex behavior explicit and test exact expected output.

This test currently validates an implementation-dependent outcome with only XCTAssertNotNil, which can hide parsing regressions. Please assert a deterministic contract for odd-length input (reject with nil, or accept with a specific byte result) and verify that exact result.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/swift-sdk/SwiftTests/SwiftDashSDKTests/PlatformWalletTypesTests.swift`
around lines 27 - 34, The test testDataFromOddLengthHexString currently only
asserts non-nil for an implementation-dependent outcome; change it to assert a
deterministic contract: decide whether Data(hexString:) should reject odd-length
hex (preferred) or normalize it, then update the test to assert that exact
behavior—for example, if you choose rejection, replace XCTAssertNotNil(data)
with XCTAssertNil(data) and optionally assert a specific error/path; if you
choose acceptance, assert the exact expected bytes (e.g., XCTAssertEqual(data,
expectedData)). Ensure the assertion references the Data(hexString:) initializer
and the test method name testDataFromOddLengthHexString so the behavior is
explicit and reproducible.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/swift-sdk/run_tests.sh`:
- Around line 11-17: The script run_tests.sh currently sets SIM_NAME by parsing
device display names which can be ambiguous; instead derive a SIM_UDID and use
-destination "id=$SIM_UDID". Update run_tests.sh to introduce a SIM_UDID
variable (e.g., SIM_UDID="${SIM_UDID:-}") and, when empty, run xcrun simctl list
devices available to pick the first matching iPhone device UDID (not the display
name). Replace uses of SIM_NAME/-destination "platform=iOS
Simulator,name=$SIM_NAME" with -destination "id=$SIM_UDID" so xcodebuild targets
the exact simulator UDID.

In
`@packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/CoreRPCClient.swift`:
- Around line 74-76: CoreRPCClient.call builds a URLRequest but doesn't set a
timeout, leaving the default (~60s idle) which can hang tests; set an explicit
timeoutInterval on the URLRequest (e.g., request.timeoutInterval = 30) before
using URLSession to bound RPC call time, and ensure any related helper paths in
CoreRPCClient.call respect this timeout when creating the request.

---

Nitpick comments:
In
`@packages/swift-sdk/SwiftTests/SwiftDashSDKTests/PlatformWalletTypesTests.swift`:
- Around line 27-34: The test testDataFromOddLengthHexString currently only
asserts non-nil for an implementation-dependent outcome; change it to assert a
deterministic contract: decide whether Data(hexString:) should reject odd-length
hex (preferred) or normalize it, then update the test to assert that exact
behavior—for example, if you choose rejection, replace XCTAssertNotNil(data)
with XCTAssertNil(data) and optionally assert a specific error/path; if you
choose acceptance, assert the exact expected bytes (e.g., XCTAssertEqual(data,
expectedData)). Ensure the assertion references the Data(hexString:) initializer
and the test method name testDataFromOddLengthHexString so the behavior is
explicit and reproducible.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0a0c245b-b203-4fe5-8d83-2191641ba8ff

📥 Commits

Reviewing files that changed from the base of the PR and between f3c0cad and 361114b.

📒 Files selected for processing (40)
  • .github/workflows/swift-sdk-build.yml
  • .serena/project.yml
  • packages/swift-sdk/Package.swift
  • packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/README.md
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/CreateIdentityView.swift
  • packages/swift-sdk/SwiftTests/Package.swift
  • packages/swift-sdk/SwiftTests/Sources/SwiftDashSDKMock/SwiftDashSDK.h
  • packages/swift-sdk/SwiftTests/Sources/SwiftDashSDKMock/SwiftDashSDKMock.c
  • packages/swift-sdk/SwiftTests/SwiftDashSDK.h
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Core/CoreSendIntegrationTests.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Platform/SDKBootstrapIntegrationTests.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/CoreRPCClient.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/IntegrationTestCase.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/IntegrationTestEnv.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/LocalDevnet.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/Shell.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/TestWallet.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKTests/IdentityManagerTests.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKTests/PlatformWalletIntegrationTests.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKTests/PlatformWalletTests.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKTests/PlatformWalletTypesTests.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/ContactRequestTests.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/DataContractTests.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/DocumentTests.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/EstablishedContactTests.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/IdentityManagerTests.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/IdentityTests.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/ManagedIdentityTests.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/MemoryManagementTests.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/PlatformWalletIntegrationTests.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/PlatformWalletTypesTests.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/SDKTests.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/SwiftConstants.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/TokenTests.swift
  • packages/swift-sdk/SwiftTests/run_tests.sh
  • packages/swift-sdk/Tests/SwiftDashSDKTests/KeyWallet/WalletSerializationTests.swift
  • packages/swift-sdk/build_ios.sh
  • packages/swift-sdk/example/SwiftSDKExample.swift
  • packages/swift-sdk/run_integration_tests.sh
  • packages/swift-sdk/run_tests.sh
💤 Files with no reviewable changes (21)
  • packages/swift-sdk/Tests/SwiftDashSDKTests/KeyWallet/WalletSerializationTests.swift
  • packages/swift-sdk/SwiftTests/Sources/SwiftDashSDKMock/SwiftDashSDK.h
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/SwiftConstants.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/PlatformWalletIntegrationTests.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/DocumentTests.swift
  • packages/swift-sdk/example/SwiftSDKExample.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/MemoryManagementTests.swift
  • packages/swift-sdk/SwiftTests/Package.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDK.h
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/EstablishedContactTests.swift
  • packages/swift-sdk/SwiftTests/run_tests.sh
  • packages/swift-sdk/SwiftTests/Sources/SwiftDashSDKMock/SwiftDashSDKMock.c
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/PlatformWalletTypesTests.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/ManagedIdentityTests.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/IdentityTests.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/IdentityManagerTests.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/ContactRequestTests.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKTests/PlatformWalletTests.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/TokenTests.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/SDKTests.swift
  • packages/swift-sdk/SwiftTests/Tests/SwiftDashSDKTests/DataContractTests.swift

Comment thread packages/swift-sdk/run_tests.sh

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The PR adds a Swift SDK integration-test framework against a local dashmate devnet. Validation confirmed: the shared SwiftData container makes the global transaction-count assertion brittle, the missing README pointer is real, the DASHMATE_CONFIG env var is read by the test binary but ignored by the lifecycle/probe in the runner, and ensureSPVStarted/trackedWalletIds have unsynchronized check-then-act on nonisolated(unsafe) state. No in-scope blocker; recommending COMMENT.

🟡 3 suggestion(s) | 💬 3 nitpick(s)

Out-of-scope follow-up suggestions (2)

These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.

  • Net loss of Swift unit-test coverage from mock-based suite removal — The PR deletes ~2500 lines of older mock-based unit tests (Document/Identity/MemoryManagement/Token/ContactRequest/DataContract/EstablishedContact/ManagedIdentity/SDK/WalletSerialization) and replaces them with ~140 lines of trivial getter/error-path coverage. The deletions are justified — the mocks didn't reflect the real FFI — but the replacement is much thinner. Out of scope because recreating that coverage against real FFI is a substantial separate effort.
    • Follow-up: Open a follow-up issue enumerating behaviors the deleted unit tests covered (document CRUD, opaque-handle memory management, token ops) and decide which deserve real-FFI unit or integration coverage.
  • Integration suite is skipped in CI by design — can rot silentlyrun_tests.sh does not set RUN_INTEGRATION_TESTS=1, so the new integration tests all hit XCTSkipUnless in CI. This is the intended split (CI runs unit + xcodebuild example app; dashmate-dependent suite runs locally), but it means the framework itself is never exercised in CI and regressions can land unnoticed.
    • Follow-up: Track adding a self-hosted/nightly job that provisions dashmate and runs run_integration_tests.sh.

Comment thread packages/swift-sdk/run_integration_tests.sh Outdated
Comment thread packages/swift-sdk/run_integration_tests.sh Outdated
@ZocoLini ZocoLini force-pushed the feat/swift-sdk-integration-tests branch from 59ef0d4 to ea8c626 Compare May 26, 2026 21:16

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/swift-sdk-build.yml:
- Around line 95-98: The workflow currently disables failure handling with "set
+e" and forces success with a trailing "true", causing failures in "yarn
dashmate group stop --group=local --force" and "yarn dashmate group reset
--group=local --hard --verbose" to be ignored; restore strict error handling by
removing "set +e" and the final "true" (or re-enable with "set -e" after the
block) so any non-zero exit from those yarn dashmate commands fails the job, or
explicitly propagate errors by appending "|| exit 1" to the reset command.

In
`@packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/IntegrationTestCase.swift`:
- Line 9: The shared cached variable bootstrapResult in IntegrationTestCase is
accessed from nonisolated(unsafe) context in sharedEnv() and can race; protect
all reads/writes to bootstrapResult by introducing synchronization (e.g., a
private static serial DispatchQueue or an actor) and marshal all accesses
through it inside sharedEnv() and any other accessors; update sharedEnv() to
perform the check/read/write of bootstrapResult on that queue (or via await if
using an actor) so initialization is atomic and thread-safe while keeping the
existing API.

In
`@packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/IntegrationTestEnv.swift`:
- Around line 18-20: IntegrationTestEnv currently exposes nonisolated(unsafe)
shared mutable state via spvStarted and trackedWalletIds and performs an
unsynchronized check/set in ensureSPVStarted(), causing race conditions; fix by
moving these vars into a synchronized context (either make IntegrationTestEnv an
actor or add a private serial synchronization primitive such as a dedicated
DispatchQueue or Lock) and update all accessors (ensureSPVStarted(), any
append/iterate/clear operations on trackedWalletIds) to run on that
synchronization context so the check-and-set in ensureSPVStarted() is atomic (no
await between check and set) and all mutations/read of trackedWalletIds are
serialized.

In
`@packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/Shell.swift`:
- Around line 74-77: The code currently calls process.waitUntilExit() before
reading stdout/stderr which can deadlock; change Shell.run (or the function
creating Process and using stdoutPipe/stderrPipe) to read the pipes
asynchronously: set stdoutPipe.fileHandleForReading.readabilityHandler and
stderrPipe.fileHandleForReading.readabilityHandler to append incoming Data into
local Data buffers, then call process.waitUntilExit(), then clear the
readabilityHandlers and use the accumulated Data (instead of calling
readDataToEndOfFile() after waitUntilExit()). Ensure handlers are removed (set
to nil) to avoid leaks and convert the collected Data to strings as before.

In
`@packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/TestWallet.swift`:
- Around line 44-49: The loop currently checks the deadline before calling
condition(), which can suppress an exception thrown by condition() on the final
attempt; change the loop in the waiting helper (the block that creates deadline,
calls try await condition(), sleeps with Task.sleep using pollInterval, and
throws TimeoutError) so you call try await condition() first, return on success,
then if Date() >= deadline throw the TimeoutError, and only then await
Task.sleep; this ensures any error from condition() on the final attempt is
propagated instead of being replaced by the TimeoutError.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 44a6106d-d8be-4e58-af49-1a307003d13a

📥 Commits

Reviewing files that changed from the base of the PR and between 361114b and 59ef0d4.

📒 Files selected for processing (11)
  • .github/workflows/swift-sdk-build.yml
  • packages/swift-sdk/Package.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Core/CoreSendIntegrationTests.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Platform/SDKBootstrapIntegrationTests.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/CoreRPCClient.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/IntegrationTestCase.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/IntegrationTestEnv.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/LocalDevnet.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/Shell.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/TestWallet.swift
  • packages/swift-sdk/run_integration_tests.sh

Comment thread .github/workflows/swift-sdk-build.yml Outdated
@ZocoLini ZocoLini force-pushed the feat/swift-sdk-integration-tests branch from ea8c626 to def4241 Compare May 26, 2026 21:27

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Latest delta is CI-only: three new workflow steps that reset the local dashmate stack, run the new Swift integration suite via run_integration_tests.sh, and always stop dashmate on exit. No FFI, consensus, crypto, or production paths are touched. All six prior findings against 361114b still apply verbatim at HEAD (none were addressed in the delta), plus the new CI wiring introduces two related concerns around error swallowing on reset and the duplicated --group=local ownership between the workflow and the runner script.

🟡 4 suggestion(s) | 💬 4 nitpick(s)

Out-of-scope follow-up suggestions (1)

These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.

  • Prior SwiftTests Swift Package and example app cleanup — The cumulative diff against v3.1-dev deletes packages/swift-sdk/SwiftTests/Package.swift, SwiftDashSDK.h, run_tests.sh, and example/SwiftSDKExample.swift. These removals look intentional given the test reorganisation, but they break previously documented entry points that may be referenced from external docs or downstream consumers.
    • Follow-up: Author-requested follow-up PR: sweep README/docs for references to SwiftTests/Package.swift, SwiftDashSDK.h, and example/SwiftSDKExample.swift and update or repoint them.

Comment thread packages/swift-sdk/run_integration_tests.sh Outdated
Comment thread packages/swift-sdk/run_integration_tests.sh Outdated
Comment thread .github/workflows/swift-sdk-build.yml Outdated
Comment thread .github/workflows/swift-sdk-build.yml Outdated
@ZocoLini ZocoLini force-pushed the feat/swift-sdk-integration-tests branch 2 times, most recently from 9031b50 to 9069b49 Compare May 26, 2026 21:42

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/swift-sdk-build.yml:
- Line 94: The workflow is using floating refs (actions/setup-node@v4 and
cargo-bins/cargo-binstall@v1.3.1); pin both Actions to immutable commit SHAs
instead of version tags to harden supply-chain integrity — locate the
corresponding repository commit SHAs for actions/setup-node and
cargo-bins/cargo-binstall (from their GitHub repos or Marketplace pages) and
replace the usages "actions/setup-node@v4" and
"cargo-bins/cargo-binstall@v1.3.1" with "actions/setup-node@<commit-sha>" and
"cargo-bins/cargo-binstall@<commit-sha>" respectively, keeping the rest of the
workflow unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7d295ba4-9bf0-4735-bc72-4c3159f6e942

📥 Commits

Reviewing files that changed from the base of the PR and between 59ef0d4 and 9031b50.

📒 Files selected for processing (11)
  • .github/workflows/swift-sdk-build.yml
  • packages/swift-sdk/Package.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Core/CoreSendIntegrationTests.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Platform/SDKBootstrapIntegrationTests.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/CoreRPCClient.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/IntegrationTestCase.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/IntegrationTestEnv.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/LocalDevnet.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/Shell.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Support/TestWallet.swift
  • packages/swift-sdk/run_integration_tests.sh

Comment thread .github/workflows/swift-sdk-build.yml Outdated
@ZocoLini ZocoLini marked this pull request as draft May 26, 2026 21:42

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The latest delta only adds a Node 22 pinning step and a corepack-enable step to the CI workflow before the dashmate lifecycle. None of the eight previously reported findings were addressed; all are reproducible at def4241 and carried forward. No new issues introduced by the delta itself.

🟡 4 suggestion(s) | 💬 4 nitpick(s)

2 additional finding(s) omitted (not in diff).

Out-of-scope follow-up suggestions (1)

These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.

  • Self-hosted runner global-state side effects from setup-node + corepack — The newly added actions/setup-node@v4 + corepack enable steps run on a self-hosted macOS ARM64 runner. setup-node mutates PATH and corepack-managed yarn shims for the runner user; on long-lived self-hosted runners this can leave state behind between jobs (e.g. pinning Node 22 for subsequent unrelated workflows that expect system Node). Worth tracking but not blocking this PR.
    • Follow-up: Create a separate issue to audit self-hosted runner global-state interactions from setup-node and corepack across the platform CI matrix.

Comment thread packages/swift-sdk/run_integration_tests.sh Outdated
Comment thread packages/swift-sdk/run_integration_tests.sh Outdated

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Verified all 8 prior findings against current head 9031b50 — all remain STILL VALID and are carried forward. The latest delta (def4241..9031b50) only adds CI provisioning of cargo-binstall, wasm-bindgen-cli@0.2.108, and wasm-pack to .github/workflows/swift-sdk-build.yml. One new finding: wasm-pack is installed unpinned alongside a pinned wasm-bindgen-cli, which weakens CI reproducibility. No blocking issues; all findings are suggestions/nitpicks against new test/CI infrastructure.

🟡 4 suggestion(s) | 💬 5 nitpick(s)

Most findings were posted inline. GitHub could not place the workflow findings on the current diff, so I’m including those carried-forward/latest-delta items here instead of letting them disappear:

Additional verified findings not posted inline

🟡 Suggestion: Carried-forward prior finding: reset step swallows all errors, hiding broken-devnet failures from CI

.github/workflows/swift-sdk-build.yml lines 110-116

The block uses set +e and a trailing true, so the step always exits 0 — even if yarn dashmate group reset --group=local --hard --verbose fails (corrupt state, missing config, permission issue). The integration-tests step then runs against stale or broken devnet state and can produce misleading failures or false greens. The wasm tooling steps added at lines 101–108 do not change this. Fail loudly on reset errors, or scope set +e to only the expected 'nothing to stop' case from group stop.

💬 Nitpick: New finding in latest delta: wasm-pack version is unpinned in CI

.github/workflows/swift-sdk-build.yml lines 107-108

The delta adds cargo binstall wasm-pack -y without a version pin, while the sibling step pins wasm-bindgen-cli@0.2.108. cargo binstall resolves to the latest published wasm-pack each time CI runs, so an upstream release can break the integration-test job on a green PR with no change in this repo. Pin wasm-pack to a known-good version (consistent with the wasm-bindgen-cli pin) so CI builds remain reproducible.

      - name: Install wasm-pack
        run: cargo binstall wasm-pack@0.13.1 -y
💬 Nitpick: Carried-forward prior finding: CI workflow and runner script duplicate (and can conflict on) dashmate lifecycle

.github/workflows/swift-sdk-build.yml lines 110-125

The workflow resets dashmate (lines 110–116), runs run_integration_tests.sh (118–120), then unconditionally stops dashmate (122–125). The script itself has its own 'start if not reachable' branch (run_integration_tests.sh:55–61) that also calls group stop then group start for --group=local. Two independent lifecycle owners increase the chance of ordering / config drift between local and CI, and make failures harder to diagnose. Consolidate ownership in one layer.

Comment thread packages/swift-sdk/run_integration_tests.sh Outdated
Comment thread packages/swift-sdk/run_integration_tests.sh Outdated
@ZocoLini ZocoLini force-pushed the feat/swift-sdk-integration-tests branch from 9069b49 to ef01ba9 Compare May 26, 2026 21:58
@QuantumExplorer QuantumExplorer removed this from the v4.0.0 milestone Jun 1, 2026
@ZocoLini ZocoLini force-pushed the feat/swift-sdk-integration-tests branch 4 times, most recently from 8c51c88 to e345afd Compare June 8, 2026 06:26
@ZocoLini ZocoLini force-pushed the feat/swift-sdk-integration-tests branch from e345afd to 707307c Compare June 9, 2026 06:53
@ZocoLini ZocoLini force-pushed the feat/swift-sdk-integration-tests branch 2 times, most recently from 04e1818 to d3615e2 Compare June 16, 2026 16:25

@LuuOW LuuOW left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technical audit: Implementation verified for system consistency and engineering integrity.

@ZocoLini ZocoLini force-pushed the feat/swift-sdk-integration-tests branch 6 times, most recently from c49eaff to 074ee15 Compare June 21, 2026 15:22
@ZocoLini ZocoLini force-pushed the feat/swift-sdk-integration-tests branch from 074ee15 to 7fc319d Compare June 23, 2026 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants